<template>
	<view>
		<view class="input-search">
			<uni-icons type="search" size="40" color="#18bc9c" @click=""></uni-icons>
			<uni-easyinput   trim="all" v-model="keyword" :styles="styles" :placeholderStyle="placeholderStyle"></uni-easyinput>
			<button @click="search">搜索</button>
		</view>
		
		<!-- stripe type="selection" 开启多选 -->
		<uni-table ref="table" :loading="loading" emptyText="暂无更多数据" filter-type="search"  @selection-change="selectionChange">
		    <uni-tr>
		      <uni-th class="th-class">状态</uni-th>
		      <uni-th class="th-class">日期</uni-th>
		      <uni-th class="th-class">销售订单号</uni-th>
			  <uni-th class="th-class">订单数量</uni-th>
			  <uni-th class="th-class">已出库</uni-th>
			  <uni-th class="th-class">待出库</uni-th>
		      <uni-th class="th-class">客户</uni-th>
		      <uni-th class="th-class">物料编码</uni-th>
		      <uni-th class="th-class">物料名称</uni-th>
			  <uni-th class="th-class">规格</uni-th>
			  <uni-th class="th-class">计量单位</uni-th>
			  <uni-th class="th-class">摘要</uni-th>
			  <uni-th class="th-class">备注</uni-th>
		    </uni-tr> 
			<uni-tr v-for="(item, index) in card_arr" :key="index" >
				<uni-td align="left" class="td-class">
				<text>{{ item.FMrpClosed==1? "已完成" : "未完成"  }}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FDate}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FBillNo}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FQty}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FCommitQty}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FNoCommitQty}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.orgName}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FNumber}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FName}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FModel}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.unitName}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FExplanation}}</text></uni-td>
				<uni-td align="left" class="td-class">
				<text>{{item.FNote}}</text></uni-td>
		    </uni-tr>
		</uni-table>
		
		<view class="uni-pagination-box">
			<uni-pagination show-icon :page-size="pageSize" :current="currentPage"
		    :total="total" @change="change" />
		</view>
	</view>
</template>

<script>
// 引入uni-ui组件
import {
  uniPagination,
  uniTable,
  uniTr,
  uniTh,
  uniTd,
  uniEasyinput,
  uniIcons
} from "@dcloudio/uni-ui"
export default {
	components: {
	  uniPagination,
	  uniTable,
	  uniTr,
	  uniTh,
	  uniTd,
	  uniEasyinput,
	  uniIcons
	},
	data() {
		return {
			card_arr: [],//当前页码的表格数据
			pageSize: 15,// 每页数据量
			currentPage: 1,// 当前页
			total: 0,// 数据总量
			loading: false,
			placeholderStyle:'font-size:16px;',
			styles:{
				borderColor: '#999'
			},
			keyword:'',
			where:'',
			selectedIndexs:[],//选中
		}
	},
	methods: {
		// 多选
		selectionChange(e) {
			this.selectedIndexs = e.detail.index
		},
		// 搜索
		search() {
			this.currentPage = 1;
			this.getlist();
		},
		change(e) {
		  this.currentPage = e.current
		  this.getlist()
		},
		//获取列表
		getlist() {
			this.$Api.getseorderbywifi(this.currentPage,this.keyword).then(res => {
				if (res.data.code == 1) {
					var array = res.data.data.rows
					if (this.currentPage == 1) {
						this.card_arr = array;
					} else {
						this.card_arr = this.card_arr.concat(array);
					}
					this.total = res.data.data.total
					uni.stopPullDownRefresh()
				} else {
					this.card_arr = []
				}
			})
		},
	},
	mounted() {
		this.getlist()
	},
	onReachBottom() {
		this.currentPage++;
		if (this.currentPage > this.total) {
			uni.hideNavigationBarLoading();
			uni.showToast({
				title: '暂无更多数据',
				icon: 'none'
			})
		} else {
			this.getlist()
			console.log('到底了');
		}
	},
}
</script>

<style lang="less">
	
</style>
